package com.tz;

import com.tz.dao.FaqDao;
import com.tz.entity.Faq;
import org.junit.FixMethodOrder;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.MethodSorters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by Administrator on 16-8-5.
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = AppConfig.class)
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class InitData {

    @Autowired
    private FaqDao faqDao;

    @Test
    public void initFaqs(){
        Faq faq1 = new Faq("Register","Register");
        Faq faq2 = new Faq("Login","Can't login");
        Faq faq3 = new Faq("Pay","Can't pay");
        Faq faq4 = new Faq("Send Goods","How long to send");
        Faq faq5 = new Faq("Product","decription error");

        faqDao.saveFaq(faq1);
        faqDao.saveFaq(faq2);
        faqDao.saveFaq(faq3);
        faqDao.saveFaq(faq4);
        faqDao.saveFaq(faq5);
    }
}
